const { list } = require('./src/mock')
const bodyParser = require('body-parser')
module.exports = {
  devServer: {
    before(app) {
      app.use(bodyParser.json())
      app.get('/list', (req, res) => {
        res.send({
          code: 200,
          data: list
        })
      })


      app.post('/api/detail', (req, res) => {
        res.send({
          code: 200,
          data: list.find(item => item.id === req.body.id)
        })
      })
    }
  }
}